Back to course home
0% completed
Vote For New Content
Oracle Hard
Integer to English Words (hard)
Solution: Integer to English Words
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Merge K Sorted Lists (hard)
Solution: Merge K Sorted Lists
Max Points on a Line (hard)
Solution: Max Points on a Line
Sudoku Solver (hard)
Solution: Sudoku Solver
Longest Valid Parentheses (hard)
Solution: Longest Valid Parentheses
Remove Nth Node From End of List (Medium)
Solution: Remove Nth Node From End of List
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Constrained Subsequence Sum (hard)
Solution: Constrained Subsequence Sum
Longest Palindromic Substring (medium)
Problem Statement
Given a string s, return the longest palindromic substring in s.
A string is called palindromic if it reads same from forward as backward.
A substring is a contiguous sequence of characters in the string.
Examples
-
Example 1:
- Input: s =
"racecar" - Expected Output:
"racecar" - Justification: The entire string is a palindrome and is the longest substring.
- Input: s =
-
Example 2:
- Input: s =
"abccd" - Expected Output:
"cc" - Justification: The longest palindromic substring is
"cc"in the stringabccd.
- Input: s =
-
Example 3:
- Input: s =
"xyzzy" - Expected Output:
"yzzy" - Justification: The substring
"yzzy"is the longest palindromic substring.
- Input: s =
Try it yourself
Try solving this question here:
Java
. . . .
Solution: Valid Parentheses
Solution: Longest Palindromic Substring
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself